unit dgAddPort ;

interface

uses
   Windows,
   Messages,
   SysUtils,
   Variants,
   Classes,
   Graphics,
   Controls,
   Forms,
   Dialogs,
   SpTBXControls,
   StdCtrls,
   SpTBXEditors,
   TBXDkPanels,
   TBXExtItems,
   TB2Item,
   TBX,
   SpTBXItem,
   TB2ExtItems,
   TB2Dock,
   TB2Toolbar,
   uBasic,
   TntStdCtrls,
   uObjects ;

type
   TdlgAddPort = class( TForm )
      Panel : TSpTBXPanel ;
      SpTBXButton1 : TSpTBXButton ;
      SpTBXButton2 : TSpTBXButton ;
      SpTBXGroupBox2 : TSpTBXGroupBox ;
      SpTBXGroupBox3 : TSpTBXGroupBox ;
      edLabel : TSpTBXEdit ;
      edDesignator : TSpTBXButtonEdit ;
      SpTBXGroupBox1 : TSpTBXGroupBox ;
      cbType : TSpTBXComboBox ;
      procedure SpTBXButton1Click( Sender : TObject ) ;
      procedure FormCreate( Sender : TObject ) ;
   private
      fPort : TMedaPort ;
      procedure SetPort( const Value : TMedaPort ) ;
    procedure SetTitle(const Value: string);
   public
      property Title : string write SetTitle ;
      property Port : TMedaPort read fPort write SetPort ;
   end ;

implementation

{$R *.dfm}

{ TdlgAddPort }

procedure TdlgAddPort.FormCreate( Sender : TObject ) ;
begin
   fPort := nil ;
   Caption := ' New Port' ;
end ;

procedure TdlgAddPort.SetPort( const Value : TMedaPort ) ;
begin
   FPort := Value ;
   if assigned( fPort ) then begin
      edLabel.Text := fPort.Name ;
      edDesignator.Text := fPort.Designator ;
      cbType.ItemIndex := integer( fPort.PortType ) ;
   end ;
end ;

procedure TdlgAddPort.SetTitle(const Value: string);
begin
Caption := Value ;
end;

procedure TdlgAddPort.SpTBXButton1Click( Sender : TObject ) ;
begin
   if assigned( fPort ) then begin
   fPort.Name := edLabel.Text ;
   fPort.Designator := edDesignator.Text ;
   fPort.PortType := TMedaPortType( cbType.ItemIndex ) ;
   end ;
end ;

end.

